package com.dx.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.portlet.bind.annotation.RenderMapping;

import com.dx.pojo.LocPicking;
import com.dx.service.LocationService;

@Controller
public class LocationController {
	@Resource
	private LocationService locationService;
	
	@RequestMapping("/admin/allloc")
	@ResponseBody
	public List<LocPicking> queryallloc(){
		List<LocPicking> list=locationService.queryallloc();
		return list;
	}
	
	@RequestMapping("/admin/querylocbyid")
	@ResponseBody
	public LocPicking querylocbyid(int id){
		LocPicking loc=locationService.queryallbyid(id);
		return loc;
	}
	
	@RequestMapping("/admin/insertloc")
	@ResponseBody
	public String insertloc(LocPicking locPicking){
		int n=locationService.insertloc(locPicking);
		if(n==0){
			return "0";
		}else{
			return "1";
		}
	}
	
	@RequestMapping("/admin/updateloc")
	@ResponseBody
	public String updateloc(LocPicking locPicking){
		int n=locationService.updateloc(locPicking);
		if(n==0){
			return "0";
		}else{
			return "1";
		}
	}

}
